<?php
    include('include/header.inc.php');  // Call header
    $_SESSION['page'] = 'event';
    
    echo'<div data-role="content">';
    
    $id_theme = $_GET['theme'];
    
    //Display details of a theme
    //Title
    echo '<h2>Galerie</h2>';
    echo '<div class="tableauPage">';
?>
  <div id="gallery">

<?php
    // create an array to hold directory list
    $results = array();
    
    $folder = "picture/photos/images/".$id_theme;
    $thumbs = "picture/photos/thumbs/".$id_theme;

    // create a handler for the directory
    $handler = opendir($folder);

    // open directory and walk through the filenames
    while ($file = readdir($handler)) {
        if(substr($file, -3) == "jpg"){
            echo '<a class="ui-link" href="' . $folder . '/' . $file . '" rel="external"><img src="' . $thumbs . '/' . $file . '" alt="Image 01" /></a>';
        }
    }

    // tidy up: close the handler
    closedir($handler);

?>
  </div>

<?PHP
    
    echo '<p><a href="./detailTheme.php?theme='.$id_theme.'&event='.$_GET['event'].'" data-role="button" data-inline="true">'.$texts['back'][$_SESSION['lang']].'</a></p>';
    echo '</div></div>';
    include('include/footer.inc.php');  // Call footer
?>